SUPPORT / SAMPLES & SAS NOTES
 

Support

Usage Note 32069: A data set created as the output from SORT procedure might not be marked as sorted

DetailsAboutRate It

When a SAS® data set is created as the output of PROC SORT and the data set contains zero observations, the data set might not be marked as sorted. When the output of the CONTENTS procedure is examined, the SORTED value can be YES or NO.

The PROC CONTENTS SORTED value depends on how the data set is created.

If the data is created with code similar to:

   data foo;
   input x y;
   cards;
   1 2
   3 4
   5 6
   ;
   run;

   proc sort data=foo out=bar;
   by x;
   where y < 1;
   run;

Then SORTED will be equal to YES. If the data set is created with code similar to:

   data foo;
   input x y;
   cards;
   ;
   run;

   proc sort data=foo out=bar;
   by x;
   run;

Then SORTED will be equal to NO. The only way to get the SORTED value to YES is to use the SORTEDBY data set option in the SORT procedure, as in the following example:

   data foo;
   input x y;
   cards;
   ;
   run;

   proc sort data=foo out=bar(sortedby=x);
   by x;
   run;

The output of PROC CONTENTS will have SORTED equal to YES, but the Sort Information section will have VALIDATED equal to NO.

This behavior has occurred since at least SAS 6.12.

The problem is fixed at SAS 9.3 TS1M0.

Operating System and Release Information

Product FamilyProductSystemSAS Release
ReportedFixed*
SAS SystemBase SASz/OS8.2 TS2M09.3 TS1M0
OpenVMS VAX8.2 TS2M09.3 TS1M0
Microsoft Windows Server 2003 Datacenter Edition8.2 TS2M09.3 TS1M0
Microsoft Windows Server 2003 Enterprise Edition8.2 TS2M09.3 TS1M0
Microsoft Windows Server 2003 Standard Edition8.2 TS2M09.3 TS1M0
Microsoft Windows XP Professional8.2 TS2M09.3 TS1M0
64-bit Enabled AIX8.2 TS2M09.3 TS1M0
64-bit Enabled HP-UX8.2 TS2M09.3 TS1M0
64-bit Enabled Solaris8.2 TS2M09.3 TS1M0
ABI+ for Intel Architecture8.2 TS2M09.3 TS1M0
AIX8.2 TS2M09.3 TS1M0
HP-UX8.2 TS2M09.3 TS1M0
IRIX8.2 TS2M09.3 TS1M0
Linux8.2 TS2M09.3 TS1M0
OpenVMS Alpha8.2 TS2M09.3 TS1M0
Solaris8.2 TS2M09.3 TS1M0
Tru64 UNIX8.2 TS2M09.3 TS1M0
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.